package com.shrct.businessprocess.project.impl;

import com.shrct.businessprocess.project.RCProject;
import com.shrct.businessprocess.project.RCProjectType;
import com.shrct.businessprocess.project.RCProjectTypeExtension;
import com.shrct.businessprocess.project.impl.RCProjectImpl;
import com.shrct.businessprocess.project.proxy.RCProjectTypeExtensionProxy;
import edu.fudan.mylang.pf.BaseModelObject;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.DiscriminatorOptions;

@Entity
@DiscriminatorValue("RCPROJECTTYPEEXTENSION_TYPE")
@DiscriminatorOptions(force = true)
@DiscriminatorColumn(length = 64)
@Table(name = "rcprojecttypeextension")
public abstract class RCProjectTypeExtensionImpl extends BaseModelObject implements RCProjectTypeExtension {
  public RCProjectTypeExtensionImpl() {
    super();
  }
  
  private RCProjectType type;
  
  public RCProjectType getType() {
    return this.type;
  }
  
  public RCProjectTypeExtension setType(final RCProjectType type) {
    this.type = type;
    return this;			
    
  }
  
  @JoinColumn(name = "project_id")
  @ManyToOne(targetEntity = RCProjectImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCProject project;
  
  public RCProject getProject() {
    return this.project;
  }
  
  public RCProjectTypeExtension setProject(final RCProject project) {
    this.project = project;
    return this;			
    
  }
  
  public RCProjectTypeExtensionProxy toProxy() {
    com.shrct.businessprocess.project.proxy.RCProjectTypeExtensionProxy proxy = new com.shrct.businessprocess.project.proxy.RCProjectTypeExtensionProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
